import { SeparateCommand } from '#/shortcuts/index'
import { CommandId } from '~types/global-state'

export const separateCommand = new Map<CommandId, SeparateCommand>()

separateCommand.set('cmd:tab:reload', ({ contentTab }) => {
  contentTab.reload()
})

separateCommand.set('cmd:devtools:toggle', ({ contentTab }) => {
  contentTab.view.webContents.toggleDevTools()
})

separateCommand.set('cmd:find:toggle', ({ layoutTab, contentTab }) => {
  layoutTab.view.webContents.send('cmd:find:toggle', contentTab.view.webContents.id)
})

separateCommand.set('cmd:tab:close', ({ contentTab }) => {
  contentTab.close()
})
